<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <div id="tel"></div>
    <script>
    //封装一个函数，实现手机号钝点功能
    //函数的实参传递手机号
    var tel=document.getElementById("tel");
    function fTelFormat(tel){
       return tel.replace(/(\d{3})(\d{4})(\d{4})/,'$1 $2 $3');
    }
    tel.innerHTML=fTelFormat('18164197897');

    </script>
</body>
</html>